import java.awt._
import java.awt.image._


object FractalImage extends Component
{
	val cp = ComplexPlane
	
	override def paint (g:Graphics): Unit =
	{
		val bi = cp.getImage()
		val g2 = g.asInstanceOf[Graphics2D]
		g2.drawImage(bi, 0, 0, this)
		val imageSize = getPreferredSize()
		setSize(imageSize.width,imageSize.height)
	}

	override def update (g:Graphics): Unit =
	{
		val bi = cp.getImage()
		val g2 = g.asInstanceOf[Graphics2D]
		g2.drawImage(bi, 0, 0, this)
		val imageSize = getPreferredSize()
		setSize(imageSize.width,imageSize.height)
	}
	
	override def getPreferredSize(): Dimension =
	{
    		val bi = cp.getImage()
    		val w = bi.getWidth()
    		val h = bi.getHeight()
    		val imageSize = new Dimension(w,h)
	        imageSize
    }
}
